package test.diego.main;

import android.app.Activity;
import android.os.Bundle;
import java.util.ArrayList;
import android.widget.ArrayAdapter;
import android.widget.ListView;
 
public class RSS extends Activity  {
     
    String feedUrl = "";
    ListView rssListView = null;
    ArrayList<RSSItem> RSSItems = new ArrayList<RSSItem>();
    ArrayAdapter<RSSItem> array_adapter = null;
     
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
         
        feedUrl = "http://feeds.feedburner.com/Blogrammazione/";
         
        refreshRSSList();
         
        rssListView = (ListView) findViewById(R.id.rssListView);
         
        array_adapter = new ArrayAdapter<RSSItem>(this, R.layout.rssitem, RSSItems);
        rssListView.setAdapter(array_adapter);
         
        refreshRSSList();
    }
     
    private void refreshRSSList() {
         
        ArrayList<RSSItem> newItems = RSSItem.getRSSItems(feedUrl);
        RSSItems.clear();
        RSSItems.addAll(newItems);
         
    }
     
}